package com.voxel.sense.infomsg.view.decoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.example.com.common.utils.SizeUtils;
import com.voxel.sense.infomsg.R;


/**
 * recyclerView中item之间的上下左右边距
 */
public class TaskFileItemDivider extends RecyclerView.ItemDecoration {
    private int space= SizeUtils.dp2px(2);


    public TaskFileItemDivider() {
    }

    public TaskFileItemDivider(int space) {
        this.space = space;
    }




    /**
     * 设置内部item的偏移量
     */
    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {

        int position = parent.getChildAdapterPosition(view);
        RecyclerView.Adapter adapter = parent.getAdapter();

        if (adapter.getItemViewType(position) == R.layout.item_recycler_task_file) {
            int i = SizeUtils.dp2px(2);
            outRect.left =space;
            outRect.right =space;
        }

    }
}
